<?php
/**
 * 简历管理
 */

class EAdmin_Page_StateActive extends EAdmin_Page_Abstract
{
    private $resumeDb;
    private function loadDb()
    {
        $this->resumeDb = Db_Resume::instance();
    }
    public function validate(ME_Request $input, ME_Response $output)
    {
    	$euserInfo = Libs_EUser::getLoginStatus($input,$output);
	$output->euid = 
	$input->euid =
		$euid = $euserInfo[0];
	if(empty($euid)){
		header("location:index.php?c=login");
	}

	$state = ME_Config::get("ResumeState");
	$output->state = $state['state'];

        return true;
    }
    
    public function doDefault(ME_Request $input, ME_Response $output)
    {
	$euid = $input->euid;
	$state = Libs_EState::getEResumeState($euid);
	if(!empty($state)){
		$state_arr = explode(",",$state);
	}else{
		$state_arr = array();
	}

	$output->state_arr = $state_arr;
	$output->setTemplate("StateActive");
    }

    public function doSave(ME_Request $input, ME_Response $output)
    {
    	$euid = $input->euid;
	$state = $input->post("state");

	$result = Libs_EState::saveEResumeState(array('eid'=>$euid, 'state'=>$state));

	if($result){
		echo "<script>alert('保存成功！');window.location='index.php?c=StateActive';</script>";
		exit;
	}
    }


}
